import Mock from 'mockjs'
export default [
  {
    url: '/list',
    method: 'get',
    timeout: 1000,
    response: () => {
      const data = []
      for (let i = 0; i < 10; i++) {
        data.push(
          Mock.mock({
            name: '@cname()',
            title: '@ctitle(1,5)',
            content: '@cparagraph(100,200)',
            createTime: '@county(true)'
          })
        )
      }
      return {
        code: 10000,
        msg: '获取列表成功',
        data: data
      }
    }
  },
  {
    url: '/list',
    method: 'get',
    timeout: 1000,
    response: () => {
      const data = []
      for (let i = 0; i < 10; i++) {
        data.push(
          Mock.mock({
            name: '@cname(1,3)',
            title: '@ctitle(1,5)',
            content: '@cparagraph(100,200)',
            createTime: '@county(true)'
          })
        )
      }
      return {
        code: 10000,
        msg: '获取列表成功',
        data: data
      }
    }
  }
]

// mock 前端独立于后端做模拟数据
// 1. 后端接口没有做出来, 前端可以模拟做一些数据, url 和response中响应的数据 提前和后端确认约定好,直接以mock的数据去渲染
// 2. 等到后端将接口做好之后, 只需要替换request  联调
